ARDK for Android/com.nianticlabs.ardk.utils/ImageMath
ImageMath
[androidJvm]
object ImageMath
Kotlin wrapper for ARDK ImageMath functions.
Each function returns an android.graphics.Matrix corresponding to a 3×3 affine or projective transformation.
Functions
| Name | Summary |
|---|---|
| affineCrop | [androidJvm] fun affineCrop(source: Size, target: Size): Matrix Returns an affine transformation that crops the source size to match the aspect ratio of the target size. |
| affineFit | [androidJvm] fun affineFit(source: Size, srcOrientation: Orientation, target: Size, tgtOrientation: Orientation): Matrix Returns an affine transformation that maps normalized coordinates in the source frame to normalized coordinates in the target frame. |
| affineInvertHorizontal | [androidJvm] fun affineInvertHorizontal(): Matrix Returns an affine matrix for horizontal mirroring. |
| affineInvertVertical | [androidJvm] fun affineInvertVertical(): Matrix Returns an affine matrix for vertical mirroring. |
| affineRotation | [androidJvm] fun affineRotation(radians: Float): Matrix Returns an (u, v) -> (u', v') transformation that represents a 2D affine rotation. |
| affineScaling | [androidJvm] fun affineScaling(sx: Float, sy: Float): Matrix Returns an (u, v) -> (u', v') transformation that represents a 2D affine scaling. |
| affineTranslation | [androidJvm] fun affineTranslation(tx: Float, ty: Float): Matrix Returns an (u, v) -> (u', v') transformation that represents a 2D affine translation. |
| calculateDeviceRotation | [androidJvm] fun calculateDeviceRotation(fromOrientation: Orientation, toOrientation: Orientation): Matrix Returns an affine transform that rotates between two interface orientations around the center. |
| calculateViewRotation | [androidJvm] fun calculateViewRotation(fromOrientation: Orientation, toOrientation: Orientation): Matrix Returns an affine transform that rotates between two interface orientations around the center. |
| concatenating | [androidJvm] fun Matrix.concatenating(other: Matrix): Matrix Returns a new Matrix representing the concatenation of this matrix with another matrix, mimicking the behavior of CoreGraphics’ concatenating(_:) method on iOS. |
| displayTransform | [androidJvm] fun displayTransform(orientation: Orientation, viewportSize: Size, imageSize: Size): Matrix Returns an affine transform Matrix that maps normalized image coordinates into a coordinate space suitable for rendering the camera image in the given viewport and orientation. |
| logAffine | [androidJvm] fun Matrix.logAffine(tag: String = "MatrixTest", label: String = "Matrix") Logs the affine components of this Matrix in a readable format. |
| logMatrix | [androidJvm] fun Matrix.logMatrix(tag: String = "Matrix", label: String = "Matrix") Logs the contents of this Matrix as a 3×3 matrix. |
| reprojection | [androidJvm] fun reprojection(aspect: Float, fovRadians: Float, zNear: Float, zFar: Float, referenceView: FloatArray, targetView: FloatArray, backProjectionDistance: Float = 0.9f): Matrix Returns a 3×3 homography matrix ( android.graphics.Matrix) that reprojects image coordinates from a reference camera view into a target camera view. |
| reprojectPoints | [androidJvm] fun Matrix.reprojectPoints(pts: FloatArray) Applies a full 3×3 projective transformation (homography) to a set of 2D points, using this Matrix as a homography matrix. |